﻿using System.Collections.Generic;
using Orchard.Events;
using Orchard.Localization;
using Orchard.Logging;

namespace Whatsnexx.Rules
{
    using Services;

    public interface IActionProvider : IEventHandler
    {
        void Describe(dynamic describe);
    }

	public class PublishingActions
	{
        private readonly ITicketBusService _publishingService;

        protected PublishingActions(
            ITicketBusService publishingService)
        {
            _publishingService = publishingService;
            Logger = NullLogger.Instance;
            T = NullLocalizer.Instance;
        }

        public Localizer T { get; set; }
        public ILogger Logger { get; set; }

        protected bool SendEvent(dynamic context)
        {
            var content = context.Tokens["Content"] as Dictionary<string, string>;
            return _publishingService.SendEvent(content);
        }
	}
}